package jp.ne.hatena.d.digitalsoul.warikan.contexts

import jp.ne.hatena.d.digitalsoul.warikan.contexts.rootpopulaters._
import jp.ne.hatena.d.digitalsoul.warikan.models._
import jp.ne.hatena.d.digitalsoul.warikan.repositories._
import jp.ne.hatena.d.digitalsoul.warikan.roles._

class Accounting(val id:Int) extends PartyPopulater with SlopePopulater {
	
	val accountant:Accountant = new Party(id) with Accountant with PieMaker
	
	val pieMaker:PieMaker = accountant.asInstanceOf[PieMaker]
	
	val party:Party = populateParty(accountant)	
	
	def adjustBy(slopeId:Int) = accountant.adjust(pieMaker, slopeId)
	
	def commit = PartyRepository.add(party)
		
}